<?php

namespace App\Tables;

use Illuminate\Database\Eloquent\Model;

class MobileSms extends Model
{
    protected $table = 'mobile_sms';

    protected $fillable = ['type', 'mobile', 'content', 'content_type', 'code'];

    protected $appends = [
        'status_text'
    ];

    /**
     * 获取短信状态
     * @return mixed|string
     */
    public function getStatusTextAttribute()
    {
        switch ($this->status) {
            case 0:
                return '未发送';
            case 1:
                return '已发送';
            case 2:
                return '发送失败';
            default:
                return $this->status;
        }
    }
}
